function M1Music() {
};

M1Music.instance = function() {
  var _self = this;
  
  var model = Model.instance('{{$smarty.const.MODEL_NAME_MUSIC|escape:javascript}}', '{{$smarty.const.MODEL_TITLE_MUSIC|escape:javascript}}', '{{$smarty.const.MODEL_TYPE_ORDER|escape:javascript}}');
  
  //Create model here...
  var state1 = State.instance(0, 'Inactived', null);
  var state2 = State.instance(1, 'No video music', null);
  var state3 = State.instance(2, 'The video music is recevied', null);
  var transition1 = Transition.instance('Received', state2, state3, '{{$smarty.const.USER_TYPE_MANAGER_ASSISTANT|escape:javascript}}');
  var transition2 = Transition.instance('Remind', state2, state2, '{{$smarty.const.USER_TYPE_MANAGER_ASSISTANT|escape:javascript}}');
  
  transition2.validate = function(status, order, now, registrar) { return (transition2.assignee == registrar.type && ((SimpleDate.toStamp(now) - SimpleDate.toStamp(status.date)) / 86400) > 14); };
  
  transition1.custom = function(status, order, now, registrar, model, callbackFunc, pos, host) { if (DlmanageUtils.vcompleted(order, null, 5)) {
                                                                                                   DlmanageUtils.edit(order, now);
                                                                                                 }
                                                                                                 transition1.operate(status, order, now, registrar, model, callbackFunc, host);
                                                                                               };
  
  model.states = [ state1, state2, state3 ];
  model.transitions = [ transition1, transition2 ];
  return model;
};
